<?php
use app\admin\model\AuthRule;
?>
{layout name="layout/layout" /}
<div class="king-content-wrap">
    <div class="king-layout1-content" style="margin-top: 0;margin-left: 0;">
		<ol class="breadcrumb">
		    <li><span>权限管理</span></li>
		    <li><span>角色权限列表</span></li>
		</ol>
		<div class="panel panel-default m20" style="margin-top: 20px;">
            <div><h4>{$group.title}</h4></div>
            <form action="{:Url('Right/groupRule')}" method="post">
                {foreach name="rules" item="item"}
                <div>
                    <div>
                        <input type="checkbox" {in name="$item['id']" value="$group['rules']"}checked="checked"{/in} name="rules[]" value="{$item.id}" />
                        {$item.title}
                    </div>
                    <?php
                        $subItems = AuthRule::where(['parent_id' => $item['id']])->select();
                    ?>
                    {notempty name="subItems"}
                    <div style="margin:10px;">
                        {foreach name="subItems" item="sub"}
                        <span style="margin-right:10px;">
                            <input type="checkbox" {in name="$sub['id']" value="$group['rules']"}checked="checked"{/in} name="rules[]" value="{$sub.id}" />
                            {$sub.title}
                        </span>
                        {/foreach}
                    </div>
                    {/notempty}
                </div>
                {/foreach}
                <input type="hidden" name="group_id" value="{$group_id}" />
                <input type="submit" value="确定" />
			</form>
		</div>
	</div>
</div>
